package com.qersoft.entity;

import lombok.Data;
import org.springframework.http.HttpStatus;

@Data
public class CPWMessage {
    private Integer code;
    private String message;
    private String data;

    public CPWMessage(Integer code, String message, String data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static CPWMessage message(String data) {
        if (data.equals("success")) {
            return new CPWMessage(HttpStatus.OK.value(), "success:密码修改成功", data);
        } else{
            return new CPWMessage(HttpStatus.INTERNAL_SERVER_ERROR.value(), "error:原密码错误，修改失败", data);
        }

    }
}
